#include "Real.h"
sirReal::sirReal(double v[100])
{
for (int i=0; i<100;i++)
this->v[i]=v[i];
}
double sirReal::getElement(int i)
{
return this->v[i];
}
void sirReal::setElement(double x,int i)
{
    this->v[i]=x;
}
int sirReal::nrElemente()
{
int i=0;
while (this->getElement(i)!=0.0) i++;
return i;
}
void sirReal::ordonare(int k)
{
int n=this->nrElemente();
double aux;
if (k<n) {
for (int i=0;i<k-1;i++)
for (int j=i+1;j<k;j++)
    if(this->getElement(i)<this->getElement(j))
    {
        aux=this->v[i];
        this->v[i]=this->v[j];
        this->v[j]=aux;
    }
for (int i=k;i<n-1;i++)
for (int j=i+1;j<n;j++)
    if(this->getElement(i)>this->getElement(j))
    {
        aux=this->v[i];
        this->v[i]=this->v[j];
        this->v[j]=aux;
    }

}
else {
for (int i=0;i<n-1;i++)
for (int j=i+1;j<n;j++)
   {
           if(this->getElement(i)<this->getElement(j))
        {
        aux=this->v[i];
        this->v[i]=this->v[j];
        this->v[j]=aux;
        }
   }
}
}
void sirReal::listeaza()
{
    int n=this->nrElemente();
    for (int i=0;i<n;i++) cout<<this->getElement(i)<<endl;
}


